//
//  LCTaskDetailInfoTableViewCell.m
//  lechuang
//
//  Created by Mr_hi on 2023/4/25.
//  Copyright © 2023 Mooyi. All rights reserved.
//

#import "LCTaskDetailInfoTableViewCell.h"
#import "LCTaskModel.h"
#import "LCUserModel.h"

@implementation LCTaskDetailInfoTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end

@interface LCCardDetailHeadTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconView;

@property (weak, nonatomic) IBOutlet UILabel *nameLb;

@property (weak, nonatomic) IBOutlet UILabel *desLb;

@property (weak, nonatomic) IBOutlet UILabel *tagLb;

@property (weak, nonatomic) IBOutlet UILabel *commissionLb;

@property (weak, nonatomic) IBOutlet UILabel *settleModeLb;

@property (weak, nonatomic) IBOutlet UILabel *complianceLb;

@end

@implementation LCCardDetailHeadTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

- (void)setSysPoint:(CGFloat)sysPoint Task:(LCCardTaskModel *)cardTask {
    _sysPoint = sysPoint;
    _cardTask = cardTask;
    
    [self.iconView sd_setImageWithURL:[NSURL URLWithString:cardTask.tips] placeholderImage:[UIImage imageNamed:@"lc_task_task_icon"]];
    self.nameLb.text = cardTask.name;
    self.desLb.text = cardTask.des;
    
    NSMutableArray * labelArr = [NSMutableArray array];
    
    for (NSDictionary * dic in cardTask.allTags) {
        [labelArr addObject:dic[@"label"]];
    }
    
    self.tagLb.text = [labelArr componentsJoinedByString:@"|"];
    
    
    LCUserModel * userInfo = [LCUserModel mj_objectWithKeyValues:LCUserDefGet(UserInfo)];
    
    CGFloat price = cardTask.commission.floatValue * self.sysPoint * (100-userInfo.cardrate.integerValue)/100.0;
    
    self.commissionLb.text = [NSString stringWithFormat:@"达标佣金：%.2f元",price];
    
    NSArray * modeArr = @[@"",@"日结秒返",@"次月返佣",@"月月返佣",@"下单即返"];
    
    self.settleModeLb.text = [NSString stringWithFormat:@"结算模式:%@",modeArr[cardTask.settleMode]];
    
    self.complianceLb.text = [NSString stringWithFormat:@"结算要求：%@",cardTask.compliance];
}

@end



@implementation LCCardDetailImageTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
